package com.etc.rabbit;


import com.etc.entity.MatterImage;
import com.etc.util.QiNiuUtil;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@Component
@RabbitListener(queues = "uploadMatter")
public class RabbitMatterImage {

    @RabbitHandler(isDefault = true)
    public void receive(MatterImage myfile) throws IOException {
            QiNiuUtil.fileUpLoad(myfile.getFileByte(),myfile.getUserphone()+"/"+myfile.getOriginFileName());
//            System.out.println(myfile.getOriginFileName());


    }
}
